package threshold;

import java.util.Collections;
import java.util.List;

public class RankNDCRThresholdFinder extends MaxNDCRThresholdFinder {
	private double rk;
	
	@Override
	public List<String> initialize(List<String> args) {
		rk = Double.parseDouble(args.get(0));
		return args.subList(1, args.size());
	}
	
	@Override
	public double find(List<Integer> label, List<Double> predicted) {
		List<Pair> pairList = getPairs(label, predicted);
		Collections.sort(pairList, comp);
		
		int rank = (int)(pairList.size() * rk);
		System.out.println("rank = " + rank);
		return pairList.get(rank).logProb;
	}
}
